package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * ums_service_dept实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class UmsServiceDept implements Serializable{
	/***/
    @ApiModelProperty(value = "")
	private Integer id; 
	/**服务机构名称*/
    @ApiModelProperty(value = "服务机构名称")
    @NotBlank(message = "服务机构名称不可为空")
	private String deptName;
	/**服务机构地址*/
    @NotBlank(message = "服务机构地址不可为空")
    @ApiModelProperty(value = "服务机构地址")
	private String deptAddr; 
	/**合作起始时间*/
    @NotNull(message = "合作起始时间不可为空")
    @ApiModelProperty(value = "合作起始时间")
	private Date startTime;
	/**合作终止时间*/
    @NotNull(message = "合作终止时间不可为空")
    @ApiModelProperty(value = "合作终止时间")
	private Date endTime; 
	/**省份*/
    @ApiModelProperty(value = "省份")
	private String province; 
	/**地市*/
    @ApiModelProperty(value = "地市")
	private String city; 
	/**区*/
    @ApiModelProperty(value = "区")
	private String area;
	/**01-未合作 02-合作中 03-审核中*/
    @ApiModelProperty(value = "01-未合作 02-合作中 03-审核中 04-冻结")
	private String status; 
	/**联系人名称*/
    @ApiModelProperty(value = "联系人名称")
	private String contactsName; 
	/**联系人电话*/
    @ApiModelProperty(value = "联系人电话")
	private String phone; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**修改时间*/
    @ApiModelProperty(value = "修改时间")
	private Date updateTime; 
	/**注释*/
    @ApiModelProperty(value = "注释")
	private String remarks;
	/**场馆数量*/
    @ApiModelProperty(value = "场馆数量")
	private Long siteCount;
	/**
	 * 实例化
	 */
	public UmsServiceDept() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public UmsServiceDept(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("deptName") instanceof String) {
			this.setDeptName((String) obj.get("deptName"));
		}
		if (obj.get("deptAddr") instanceof String) {
			this.setDeptAddr((String) obj.get("deptAddr"));
		}
		this.setStartTime((Date) obj.get("startTime"));
		this.setEndTime((Date) obj.get("endTime"));
		if (obj.get("province") instanceof String) {
			this.setProvince((String) obj.get("province"));
		}
		if (obj.get("city") instanceof String) {
			this.setCity((String) obj.get("city"));
		}
		if (obj.get("status") instanceof String) {
			this.setStatus((String) obj.get("status"));
		}
		if (obj.get("contactsName") instanceof String) {
			this.setContactsName((String) obj.get("contactsName"));
		}
		if (obj.get("phone") instanceof String) {
			this.setPhone((String) obj.get("phone"));
		}
		this.setCreateTime((Date) obj.get("createTime"));
		this.setUpdateTime((Date) obj.get("updateTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getDeptName() != null) {
			result.put("deptName",this.getDeptName());
		}
		if (this.getDeptAddr() != null) {
			result.put("deptAddr",this.getDeptAddr());
		}
		if (this.getStartTime() != null) {
			result.put("startTime",this.getStartTime());
		}
		if (this.getEndTime() != null) {
			result.put("endTime",this.getEndTime());
		}
		if (this.getProvince() != null) {
			result.put("province",this.getProvince());
		}
		if (this.getCity() != null) {
			result.put("city",this.getCity());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getContactsName() != null) {
			result.put("contactsName",this.getContactsName());
		}
		if (this.getPhone() != null) {
			result.put("phone",this.getPhone());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "UmsServiceDept [id=" + id + " , deptName=" + deptName + " , deptAddr=" + deptAddr + " , startTime=" + startTime + " , endTime=" + endTime + " , province=" + province + " , city=" + city + " , status=" + status + " , contactsName=" + contactsName + " , phone=" + phone + " , createTime=" + createTime + " , updateTime=" + updateTime + "  ]";
	
	}
	
	
}
